package com.example.facecompare.agenerator;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;

import java.util.Collections;

/**
 * 代码生成器，MyBaties-Plus生成规范代码的工具
 */
public class GeneratorNew {

    public static void main(String[] args) {
        String projectPath = System.getProperty("user.dir");
//        gc.setOutputDir(projectPath + "/src/main/java");
        FastAutoGenerator.create("jdbc:mysql://175.178.168.22:3306/sjht?useSSL=false&severTimezone=GMT%2b8",
                "sjht", "sjht@123456")
                .globalConfig(builder -> {
                    builder.author("tbb") // 设置作者
//                            .fileOverride() // 覆盖已生成文件
                            .outputDir(projectPath + "/src/main/java")
                            .author("tbb")
                            .disableOpenDir(); // 指定输出目录
                })
                .strategyConfig(builder -> builder.addInclude("compare_order"))

                .packageConfig(builder -> {
                    builder.parent("com.example.facecompare.user.compare.order") // 设置父包名
                            .pathInfo(Collections.singletonMap(OutputFile.xml, projectPath + "/src/main/resources/mapper/user/compare/order")); // 设置mapperXml生成路径
                })
                .strategyConfig(builder -> builder //策略配置
                        .entityBuilder()
                        .enableLombok()
                        .controllerBuilder()
                        .enableRestStyle())
//                .templateConfig(builder -> builder
//                        .mapper("fileDa") //类配置
//                )

                .execute();
    }
}
